﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="FormThread.cs" company="">
//   
// </copyright>
// <summary>
//   Defines the FormThread type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace DbDiff.WinClient.Helper
{
    using System;
    using System.Windows.Forms;

    /// <summary>
    /// </summary>
    public abstract class FormThread : ThreadBase 
    {
        #region Fields & properties
        protected Form _form;
        protected Form _parentForm;
        #endregion Fields & properties
    
        #region Constructors
        public FormThread (Form form, Form parentForm) 
            : base()
        {
            _form = form;
            _parentForm = parentForm;
        }
        #endregion Constructors

        public virtual void Show() 
        {
            try 
            {
                _parentForm.Visible = true;
                _parentForm.Enabled = false;
                _form.ShowDialog(_parentForm);
            }
            catch (Exception)
            {
                throw;
            }
        }
        public abstract void Hide();
        public override void Start()
        {
            Show();
        }
    }
}